/*
 * Middleware
 * Copyright (C) 2010/11
 * Riccardo Pulvirenti, Giuseppe Ravidà, Andrea Tino
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANDABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses
 */

/*!
 * File: wfqueue_manager_proxy.hpp
 */

#ifndef _WFQUEUE_MANAGER_PROXY_HPP_
#define _WFQUEUE_MANAGER_PROXY_HPP_

#include <iostream>
#include <string>

#include "manager.hpp"
#include "workflow.hpp"
#include "wfqueue.hpp"
#include "proxy_exception.hpp"

//-----------------------------------------------------------------------------
// Enum, struct, aliases
namespace middleware {
typedef struct {
	Manager* ptrto_manager;
} WFProxyConfig;
}
//-----------------------------------------------------------------------------
// Class definitions
namespace middleware {
/*!
 * This class provides network interface to access the workflow queue. It is
 * important to notice that constructor is private in order to let a factory
 * perform such a work.
 */
class WFQueueManagerProxy : public WFQueue {
	/*!
	 * To let factory build properly this object, we provide access to every
	 * part of it.
	 */
	friend class WFQueueProxyFactory;
public:
	/*!
	 * Destructor
	 */
	~WFQueueManagerProxy();
	/*!
	 * Enqueues a workflow.
	 */
	void enqueue(const Workflow& workflow) throw(ProxyException);
	/*!
	 * Dequeues a workflow.
	 * Orphan.
	 */
	Workflow dequeue();
private:
	/*!
	 * Privately constructs the object. Default configuration with invalid
	 * manager pointer.
	 */
	WFQueueManagerProxy();
	/*!
	 * Privately constructs the object. Assigning configuration.
	 */
	explicit WFQueueManagerProxy(WFProxyConfig conf);
	/*!
	 * Parameters for proxy.
	 */
	WFProxyConfig _config;
}; /* WFQueueManagerProxy */
} /* middleware */

#endif
